﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Crayons.Components
{
    class CustomImage
    {
        protected int width;
        protected int height;
        protected byte[] data;

        public byte[] Data
        {
            get { return data; }
        }

        public int Width
        {
            get { return width; }
        }

        public int Height
        {
            get { return height; }
        }

        public CustomImage() { }

        public CustomImage(String fileName)
        {
            Bitmap bmp = new Bitmap(fileName);
            this.width = bmp.Width;
            this.height = bmp.Height;

            Rectangle rect = new Rectangle(0, 0, this.width, this.height);
            BitmapData bmpData = bmp.LockBits(rect, ImageLockMode.ReadOnly, bmp.PixelFormat);
            int bytes = Math.Abs(bmpData.Stride) * this.height;
            data = new byte[bytes];

            System.Runtime.InteropServices.Marshal.Copy(bmpData.Scan0, data, 0, bytes);

            bmp.UnlockBits(bmpData);
            bmp.Dispose();
        }

        public byte[] ScaleImage(int multiply)
        {

            return data;
        }
    }
}
